//
//  AppDelegate+StaticMethod.m
//  HomeworkAssistant
//
//  Created by mal on 15/11/10.
//  Copyright © 2015年 mal. All rights reserved.
//

#import "AppDelegate+StaticMethod.h"

static NSString *SERVER_ADDR = @"http://124.133.20.226:8084/community";
//static NSString *SERVER_ADDR = @"http://192.168.1.210:8085/community";
static NSString *PAY_SERVER_ADDR = @"http://124.133.20.226:8088/hjgj";

static NSString *USERID = @"";
static NSString *USER_NAME = @"";
static NSString *USER_TRUE_NAME = @"";
static NSString *PORTRAIT_PATH = @"";
static NSDictionary *USER_DETAIL = nil;

static NSArray *BINDING_HOUSE_ARRAY;

@implementation AppDelegate (StaticMethod)
/**
 *  获取社区平台服务端根请求地址
 *
 *  @return <#return value description#>
 */
+ (NSString*)getServerAddr
{
    NSDictionary *preDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:@"124.133.20.226:8084", @"server_url", @"124.133.20.226:8088", @"pay_server_url", nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:preDefaults];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *strServerURL = [defaults objectForKey:@"server_url"];
    SERVER_ADDR = [[NSString alloc] initWithFormat:@"http://%@/%@", strServerURL, @"community"];
    //SERVER_ADDR = [[NSString alloc] initWithFormat:@"http://%@/%@", @"192.168.1.210:8085", @"community"];
    return SERVER_ADDR;
}
+ (void)setServerAddr:(NSString *)serverAddr
{
    SERVER_ADDR = serverAddr;
}

/**
 获取缴费平台服务端根请求地址

 @return <#return value description#>
 */
+ (NSString *)getPayServerAddr
{
    NSDictionary *preDefaults = [[NSDictionary alloc] initWithObjectsAndKeys:@"124.133.20.226:8084", @"server_url", @"124.133.20.226:8088", @"pay_server_url", nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:preDefaults];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *strServerURL = [defaults objectForKey:@"pay_server_url"];
    PAY_SERVER_ADDR = [[NSString alloc] initWithFormat:@"http://%@/%@", strServerURL, @"hjgj"];
    //PAY_SERVER_ADDR = [[NSString alloc] initWithFormat:@"http://%@/%@", @"192.168.1.102:8080", @"hjgj"];
    return PAY_SERVER_ADDR;
}
+ (void)setPayServerAddr:(NSString *)payServerAddr
{
    PAY_SERVER_ADDR = payServerAddr;
}
/**
 *  获取用户的id
 *
 *  @param userId <#userId description#>
 */
+ (void)setUserId:(NSString *)userId
{
    USERID = userId;
}
+ (NSString*)getUserId
{
    return USERID;
}
/**
 *  获取当前用户的真实姓名
 *
 *  @param userTrueName <#userTrueName description#>
 */
+ (void)setUserTrueName:(NSString *)userTrueName
{
    USER_TRUE_NAME = userTrueName;
}
+ (NSString*)getUserTrueName
{
    return USER_TRUE_NAME;
}
/**
 *  获取当前用户名
 *
 *  @param userName <#userName description#>
 */
+ (void)setUserName:(NSString *)userName
{
    USER_NAME = userName;
}
+ (NSString*)getUserName
{
    return USER_NAME;
}

/**
 设置与获取用户详情

 @param infoDic <#infoDic description#>
 */
+ (void)setUserDetailInfo:(NSDictionary *)infoDic
{
    USER_DETAIL = [[NSDictionary alloc] initWithDictionary:infoDic];
}
+ (NSDictionary *)getUserDetailInfo
{
    return USER_DETAIL;
}

+ (void)setBindingHouse:(NSArray *)houseArr
{
    BINDING_HOUSE_ARRAY = [[NSArray alloc] initWithArray:houseArr];
}
+ (NSArray *)getBindingHouse
{
    return BINDING_HOUSE_ARRAY;
}

@end
